# coding=utf-8
import maya.cmds as cmds
import maya.mel as mel
import os

#def GetCamera():
#	cmds.ls(type ='camera' )
#	perspCameras = cmds.listCameras( p=True )
#	persp = ['persp']
#	camera = set(perspCameras) - set(persp)
#	camera = list(camera)
#	return camera
	
def ThreeCamera_win():
	CamwindowName = 'ThreeCamera'
	if cmds.window (CamwindowName,ex = True):
		cmds.deleteUI (CamwindowName)
	cmds.window (CamwindowName,sizeable=1,w=960,h=540)
	
	form = cmds.formLayout(w=960,h=540)
	editor = cmds.modelEditor()
	column = cmds.columnLayout()
	playModelPanel= cmds.modelPanel (l="play")

	cmds.ls (type = 'camera')
	perspCameras = cmds.listCameras (p = True)
	persp = ['persp']
	camera = set (perspCameras) - set (persp)

	listCams = list (camera)
	for listCam in listCams:
		print listCam
		
	if len(camera)==0:
		listCam = 'persp'
	

	cmds.formLayout( form, edit=True, attachForm=[(column, 'top', 0), (column, 'left', 0), (editor, 'top', 0), (editor, 'bottom', 0), (editor, 'right', 0)], attachNone=[(column, 'bottom'), (column, 'right')], attachControl=(editor, 'left', 0, column))

	#cmds.setFocus (editor)
	cmds.modelEditor( editor, edit=True, camera= listCam,displayAppearance = 'points',textureDisplay = 'modulate',
					  displayTextures = 1,shadows = 0,textures = 0,joints = 0,jointXray = 0,imagePlane = 0,
					  ikHandles = 0,nurbsCurves = 0,objectFilterShowInHUD = 0)#headsUpDisplay = 0,
	cmds.setFocus(playModelPanel)
	cmds.viewFit()
	cmds.select(cl=1)
	cmds.showWindow(CamwindowName)